/*
 * @Date: 2023-11-13 10:52:19
 * @Author: tangjintao
 * @LastEditors: tangjintao@gsafety.com
 * @LastEditTime: 2023-11-15 16:42:35
 * @FilePath: \v2-app\src\utils\secret.ts
 */
//引用AES源码js
// eslint-disable-next-line @typescript-eslint/no-var-requires
import CryptoJS from 'crypto-js'
const key = CryptoJS.enc.Utf8.parse("ZEONE888Victory1");//十六位十六进制数作为密钥
//加密方法
function Encrypt(word: string) {
  const src = CryptoJS.enc.Utf8.parse(word);
  const encrypted = CryptoJS.AES.encrypt(src, key, {
    [Symbol.toStringTag]: "",
    buffer: undefined,
    byteLength: 0,
    byteOffset: 0,
    slice(): ArrayBuffer | undefined {
      return undefined
    },
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.Pkcs7
  })
  //将结果进行base64加密
  return encrypted.ciphertext.toString()
}

// export {Decrypt,Encrypt}
export { Encrypt }
